package com.yizn.learn.springext.beanpostprocessor;

import com.yizn.learn.springext.converter.User;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * project : my-learn
 * <p> 8.初始化Bean前后 </p>
 *
 * @author yisl
 * @date 2023-01-13【星期五】
 **/
@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if(bean instanceof User){
            ((User) bean).setName("苏三说技术123");
        }
        return bean;
    }
}
